<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="app">
    <todo>
        <!-- v-bind: 后面的这个 title 是模板中props里面的 title -->
        <todo-title slot="todo-title" v-bind:title="title"></todo-title>
        <todo-items slot="todo-times" v-for="item in todoItems" :item="item"></todo-items>
    </todo>
</div>



<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
<script>
    // slot 插槽
    Vue.component("todo", {
        template: '<div>\
                        <slot name="todo-title"></slot>\
                        <ul>\
                            <slot name="todo-times"></slot>\
                        </ul>\
                    </div>'
    });
    Vue.component("todo-title", {
        props: ['title'],
        template: '<p>{{title}}</p>'
    });
    Vue.component("todo-items", {
        props: ['item'],
        template: '<li>{{item}}</li>'
    });

    var vm = new Vue({
        el: '#app',
        data: {
            message: "hello vue!",
            title: "全栈系列课程",
            todoItems: ['Java','HTML','CSS','Linux']
        }
    });

</script>
</body>
</html>